Skip to content

fix: The thinking indicator yields to a reply the frame its bubble shows - #137

Merged
omesser merged 2 commits into
mainfrom
fix-thinking-bubble-lingers
Aug 31, 2026
Merged

omesser merged 2 commits into
mainfrom
fix-thinking-bubble-lingers

Conversation

@omesser

@omesser omesser commented Aug 31, 2026 •

Copy link
Copy Markdown
Owner

The thinking ellipsis could show alongside a displayed reply (#127's implementation of #119): the user saw the response bubble with the indicator still up, and a new turn starting mid-reply drew the indicator over it.

What

Three renderer defects, one seam:

  • Speech and the indicator could overlap. A new reactive turn starting while a reply was still in its reading window armed the grace and drew the ellipsis over the displayed line. The machine now holds mutual exclusion with speech strictly winning: while a line is displayed — its whole reading window — the indicator never shows, whatever the in-flight state does. When the line hides, a turn still in flight starts its grace from that moment, so a reply landing right then never flashes the indicator.

  • A one-tick line could be lost. Frame.dialogue rides exactly one Engine tick, and the renderer keeps only the newest placement while it waits for its next animation frame. The Engine ticks slightly faster than a display refreshes (16 ms vs ~16.7 ms), so some placements are overwritten before draw ever samples them — the line vanishes, no speech bubble shows, and the thinking indicator is left to die by its min-hold timer.

  • The clear decision lived in DOM code no test could drive, with the min-hold branch deciding when a shown indicator may hide.

The bubble decisions now live in src/bubble.js as createBubbleMachine — timers injectable, DOM supplied by main.js as callbacks. The event listener (which sees every delivery) latches the dialogue pulse; the drawn frame consumes it. A consumed reply hides the thinking indicator synchronously, before its bubble shows — the min-hold delays only silent endings, which is what it was for.

Why

#119: "when the reply arrives it becomes the speech bubble in place", and the indicator "can never get stuck: it is a pure function of InFlight state each tick". The shell already sends a consistent reply tick (thinking: false + the dialogue — try_take clears busy the same tick); the renderer was the lossy half.

Verify

  • node --test tests/ — 22 pass. The test harness itself pins the exclusion: every show/hide callback in every scenario asserts speech and the indicator are never visible together. New machine tests: a reply hides the indicator the same frame (min-hold pending or not), an overwritten pulse still shows its bubble, silent endings respect the min-hold, a reply faster than the grace never flashes the indicator, a new turn waits behind a displayed reply and surfaces only after it hides (grace restarted), a reply landing in that post-speech grace never flashes it.
  • cargo test --all-targets — 332 green, untouched.
  • Live: poke with a Director configured — the ellipsis vanishes the instant the reply bubble appears, and poking again while the reply is up shows nothing until the reply is gone.

🤖 Generated with Claude Code

…r lost

The dialogue pulse rode exactly one Engine tick while the renderer kept
only the newest placement, so a pulse could vanish between animation
frames — no speech bubble, and a thinking indicator left to die by
timer. The bubble decisions now live in bubble.js as a machine node can
test: the event listener latches every pulse, a consumed reply hides the
indicator the same frame its bubble shows, and the min-hold delays only
silent endings.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@omesser omesser changed the title The thinking indicator yields to a reply the frame its bubble shows fix: The thinking indicator yields to a reply the frame its bubble shows Aug 31, 2026
A new turn starting while a reply was still displayed drew the indicator
over it. The indicator now never shows during a line's reading window;
when the line hides, a turn still in flight starts its grace from that
moment, so a reply landing right then never flashes it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant